<template>
	<view class="content">
		<image class="Group-bg" mode="scaleToFill" src="../../static/imgs/gui-index-bg.png"  lazy-load></image>

		
		<view class="index-content">
			<view class="logo">
				<image src="../../static/logo.png" mode="widthFix" lazy-load></image>
			</view>
			
			<view class="index-content-tips">
				<view>DC-token</view>
				<text>你的第一个智能数字钱包</text>
			</view>
			<view class="btn-div"><button type="default" class="regist-class" hover-class="active" @tap.stop="jump('up')">创建钱包</button></view>
			<!-- <view class="btn-div"><button type="default" hover-class="active" @tap.stop="jump('login')">登錄錢包</button></view> -->
			<view class="btn-div"><button type="default" hover-class="active" @tap.stop="jump('login')">导入钱包</button></view>
		</view>
		
		
		
		
		
		
		<load v-if="showLoadings"></load>
	</view>
</template>

<script>
	import {mapGetters, mapMutations} from 'vuex'
	import Load from '@/components/common/load.vue';
	import {pageto, showToast, fetch, forceUpdate} from '@/common/js/util.js'
	export default {
		data() {
			return {
				showLoadings: false
			}
		},
		components:{
			Load
		},
		onShow(){
			console.log(this.getLoginInfo);
			if(this.getLoginInfo.email){
				if(this.getLoginInfo.token){
					let url = this.getRequestUrl + '/api/index/index';
					let data = {
						id:this.getLoginInfo.id,
						token:this.getLoginInfo.token
					}
					this.showLoadings = true
					fetch(url,data,'POST').then(res=>{
						this.showLoadings = false
						if(res.data.code == 1){
							uni.switchTab({
								url:'/pages/index/index'
							})
						}
					}).catch(err=>{
						this.showLoad = false
					})
				}
			}
		},
		computed: {
			i18n() {
				return this.$t('message')
			},
			...mapGetters([
				'getRequestUrl',
				'getLang',
				'getIncode',
				'getLoginInfo',
				'getLogin',
				'getLangType'
			])
		},
		methods:{
			jump(val){
				switch (val){
					case 'up':
						uni.navigateTo({
							url:'/pages/new-login/new-register'
						})
						// login 
						break;
					case 'login':
						uni.navigateTo({
							url:'/pages/new-login/new-login'
						})
						break;
					case 'down':
						uni.navigateTo({
							url:'/pages/new-login/Import-wallet'
						})
						break;
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.content{
		width: 100%;
		height: 100vh;
		position: relative;
		.Group-bg{
			position: absolute;
			left: 0;
			top: 0;
			right: 0;
			bottom: 0;
			z-index: -1;
			width: 100%;
			height: 100%;
		}
		.index-content{
			position: absolute;
			width: 100%;
			top: 400upx;
			left: 0;
			.logo{
				text-align: center;
				height: 164rpx;
				flex-shrink: o;
				image{
					width: 163rpx;
					text-align: center;
					height: 164rpx;
					flex-shrink: o;
				}
			}
			.index-content-tips{
				text-align: center;
				margin-bottom: 40upx;
				text{
					font-size: 30upx;
					color: #FFFFFF;
				}
				view{
					font-size: 50upx;
					color: #FFFFFF;
					font-weight: bold;
				}
			}
			.btn-div{
				&:first-of-type{
					button{
						background-color: #26375e;
						border: none;
					}
				}
				button{
					width: 500upx;
					height: 100upx;
					line-height: 100upx;
					border-radius: 50upx;
					text-align: center;
					font-size: 30upx;
					background-color: transparent;
					border: 1upx solid #ffffff;
					color: #FFFFFF;
					margin-bottom: 68upx;
					&.regist-class{
						background-color: #26375e;
						border:none;
					}
					&.active{
						transform: scale(.9);
						opacity: .9;
					}
				}
			}
		}
		
		
		
		
		
	}
	
	
</style>
